The digitalization of the physical resources such as books, pictures, documents and so on usually takes the forms of scanning, recognition and extraction. The documents are first scanned to PDF format, then the recognitions of the document modules and the text are carried out, and then the recognized information are extracted, so as to be filed and supplied to a search engine for indexing. In the prior art, it takes a lot of system resources, including CPU and memory resources, to operate on a large number of documents in PDF format, and the processing speed of the documents in PDF format is also slower. In order to improve the processing speed, various ways have been chosen, and especially in recent years, with the maturation of the technology of multicore processors, it has become one of the preferred ways to improve the computing speed to run multiple threads simultaneously on multiple CPUs.
However, in practical operation, the situation often occurs that the CPU can not be fully utilized, while the speed is limitedly increased. For example, if the CPU is fully utilized, a test opens four threads on the multicore machine, such as a 4-core CPU. When stress testing, each thread occupies one CPU. In theory, the CPU occupancy rate should be close to 100%. However, it is found in the practical test that the CPU occupancy rate is far less than 100%, and even in a lot of cases, the CPU occupancy rate is only 25%. This shows that not every CPU is at work, there should be some waiting threads. The CPU has not been fully utilized.
The inventors of the present invention carried out the analyses and researches on the causes of this phenomenon by combing their multi-year industry working experiences and experimental results, and eventually thought out that this situation occurred mainly in that in memory operational engineering, no matter whether the allocation or the release of the memory all required the thread protection and all threads shared one memory pool to access, which results in waiting for access, so that the CPU could not be fully utilized. And since the PDF operation is a very frequent operation on the memory, a large number of threads are caused to wait.
Concerning the memory access, in the memory management of a traditional operating system, each application usually is loaded into a separate process, and a private memory space is specified for each process, the memory space of one process can not communicate with that of another process. Generally speaking, one application process will create multiple entities, i.e., threads, when running, and the multiple threads belonging to one process share the resources of the process to access.
With the development of computing technology and hardware, especially in recent years, the extensive use of multicore processors, the concurrent execution of threads (parallel computing) becomes more and more common. When multiple threads are in parallel, taking the data security into account, the shared memory to access can be accessed one by one but can not be accessed simultaneously. Even though allowing for simultaneously accessing, there is frequently a situation that the allocated memory pool is not enough for the use of multiple threads, which results in waiting to access. Especially when multi-CPUs are used and each CPU run one thread, when the time required for CPU processing is less than the time for memory accessing and waiting, the memory accessing becomes the bottleneck of the computing speed, so that the CPU resources can not be fully utilized, and impeding the further increase of the computing speed is impeded.
In order to improve the memory access, the skilled in the art has proposed a variety of methods. For example, the Chinese Invention Patent which is entitled “a dynamic memory management system of a multi-threaded processor and a method thereof” and which has the grant publication No. CN 100487660C discloses a multi-threaded processor dynamic memory management method (see FIG. 1), the method comprising the steps of: Master kernel thread applying for a block of memory from the system memory as the memory pool (step 101); All kernel threads sending messages of applying memory to said master kernel thread, after the master kernel thread having received said message of applying memory, allocating the free memory from the memory pool to the kernel thread of the applied memory and sending the message of allocating memory to the kernel thread of the applied memory (step 102); Said master kernel thread querying the usage of the kernel thread applied memory, and regularly sending message of deallocating memory (step 103); After the kernel thread having received said memory message of deallocating memory, freeing the memory and sending the message of releasing memory to the master kernel thread (step 104).
To a certain extent, the method solves the problem of memory release of the kernel thread, and can avoid a certain free kernel thread taking up too much free memory at a certain moment. The hardware arbiter is replaced by the master kernel thread, and a message mechanism is used to improve the efficiency of allocating memory among various kernel threads. But this method can not solve the problem that the multiple threads which share a memory pool to access all request a larger memory space and must be queued up for. And it is necessary for this method to change the memory management codes. And thus this method is not suitable for directly transplanting the codes.